{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "#use the code here to load squad Jason files\n",
    "import json\n",
    "from pprint import pprint\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "devpath = \"data/dev-v1.1.json\"\n",
    "trainpath = \"data/train-v1.1.json\"\n",
    "\n",
    "with open(devpath) as data_file:    \n",
    "    devdata = json.load(data_file)\n",
    "with open(trainpath) as data_file:    \n",
    "    traindata = json.load(data_file)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "dict_keys(['data', 'version'])\n",
      "48\n",
      "54\n",
      "('Super Bowl 50 was an American football game to determine the champion of the '\n",
      " 'National Football League (NFL) for the 2015 season. The American Football '\n",
      " 'Conference (AFC) champion Denver Broncos defeated the National Football '\n",
      " 'Conference (NFC) champion Carolina Panthers 24–10 to earn their third Super '\n",
      " \"Bowl title. The game was played on February 7, 2016, at Levi's Stadium in \"\n",
      " 'the San Francisco Bay Area at Santa Clara, California. As this was the 50th '\n",
      " 'Super Bowl, the league emphasized the \"golden anniversary\" with various '\n",
      " 'gold-themed initiatives, as well as temporarily suspending the tradition of '\n",
      " 'naming each Super Bowl game with Roman numerals (under which the game would '\n",
      " 'have been known as \"Super Bowl L\"), so that the logo could prominently '\n",
      " 'feature the Arabic numerals 50.')\n",
      "\n",
      "[{'answers': [{'answer_start': 177, 'text': 'Denver Broncos'},\n",
      "              {'answer_start': 177, 'text': 'Denver Broncos'},\n",
      "              {'answer_start': 177, 'text': 'Denver Broncos'}],\n",
      "  'id': '56be4db0acb8001400a502ec',\n",
      "  'question': 'Which NFL team represented the AFC at Super Bowl 50?'},\n",
      " {'answers': [{'answer_start': 249, 'text': 'Carolina Panthers'},\n",
      "              {'answer_start': 249, 'text': 'Carolina Panthers'},\n",
      "              {'answer_start': 249, 'text': 'Carolina Panthers'}],\n",
      "  'id': '56be4db0acb8001400a502ed',\n",
      "  'question': 'Which NFL team represented the NFC at Super Bowl 50?'},\n",
      " {'answers': [{'answer_start': 403, 'text': 'Santa Clara, California'},\n",
      "              {'answer_start': 355, 'text': \"Levi's Stadium\"},\n",
      "              {'answer_start': 355,\n",
      "               'text': \"Levi's Stadium in the San Francisco Bay Area at Santa \"\n",
      "                       'Clara, California.'}],\n",
      "  'id': '56be4db0acb8001400a502ee',\n",
      "  'question': 'Where did Super Bowl 50 take place?'},\n",
      " {'answers': [{'answer_start': 177, 'text': 'Denver Broncos'},\n",
      "              {'answer_start': 177, 'text': 'Denver Broncos'},\n",
      "              {'answer_start': 177, 'text': 'Denver Broncos'}],\n",
      "  'id': '56be4db0acb8001400a502ef',\n",
      "  'question': 'Which NFL team won Super Bowl 50?'},\n",
      " {'answers': [{'answer_start': 488, 'text': 'gold'},\n",
      "              {'answer_start': 488, 'text': 'gold'},\n",
      "              {'answer_start': 521, 'text': 'gold'}],\n",
      "  'id': '56be4db0acb8001400a502f0',\n",
      "  'question': 'What color was used to emphasize the 50th anniversary of the '\n",
      "              'Super Bowl?'},\n",
      " {'answers': [{'answer_start': 487, 'text': '\"golden anniversary\"'},\n",
      "              {'answer_start': 521, 'text': 'gold-themed'},\n",
      "              {'answer_start': 487, 'text': '\"golden anniversary'}],\n",
      "  'id': '56be8e613aeaaa14008c90d1',\n",
      "  'question': 'What was the theme of Super Bowl 50?'},\n",
      " {'answers': [{'answer_start': 334, 'text': 'February 7, 2016'},\n",
      "              {'answer_start': 334, 'text': 'February 7'},\n",
      "              {'answer_start': 334, 'text': 'February 7, 2016'}],\n",
      "  'id': '56be8e613aeaaa14008c90d2',\n",
      "  'question': 'What day was the game played on?'},\n",
      " {'answers': [{'answer_start': 133, 'text': 'American Football Conference'},\n",
      "              {'answer_start': 133, 'text': 'American Football Conference'},\n",
      "              {'answer_start': 133, 'text': 'American Football Conference'}],\n",
      "  'id': '56be8e613aeaaa14008c90d3',\n",
      "  'question': 'What is the AFC short for?'},\n",
      " {'answers': [{'answer_start': 487, 'text': '\"golden anniversary\"'},\n",
      "              {'answer_start': 521, 'text': 'gold-themed'},\n",
      "              {'answer_start': 521, 'text': 'gold'}],\n",
      "  'id': '56bea9923aeaaa14008c91b9',\n",
      "  'question': 'What was the theme of Super Bowl 50?'},\n",
      " {'answers': [{'answer_start': 133, 'text': 'American Football Conference'},\n",
      "              {'answer_start': 133, 'text': 'American Football Conference'},\n",
      "              {'answer_start': 133, 'text': 'American Football Conference'}],\n",
      "  'id': '56bea9923aeaaa14008c91ba',\n",
      "  'question': 'What does AFC stand for?'},\n",
      " {'answers': [{'answer_start': 334, 'text': 'February 7, 2016'},\n",
      "              {'answer_start': 334, 'text': 'February 7'},\n",
      "              {'answer_start': 334, 'text': 'February 7, 2016'}],\n",
      "  'id': '56bea9923aeaaa14008c91bb',\n",
      "  'question': 'What day was the Super Bowl played on?'},\n",
      " {'answers': [{'answer_start': 177, 'text': 'Denver Broncos'},\n",
      "              {'answer_start': 177, 'text': 'Denver Broncos'},\n",
      "              {'answer_start': 177, 'text': 'Denver Broncos'}],\n",
      "  'id': '56beace93aeaaa14008c91df',\n",
      "  'question': 'Who won Super Bowl 50?'},\n",
      " {'answers': [{'answer_start': 355, 'text': \"Levi's Stadium\"},\n",
      "              {'answer_start': 355, 'text': \"Levi's Stadium\"},\n",
      "              {'answer_start': 355,\n",
      "               'text': \"Levi's Stadium in the San Francisco Bay Area at Santa \"\n",
      "                       'Clara'}],\n",
      "  'id': '56beace93aeaaa14008c91e0',\n",
      "  'question': 'What venue did Super Bowl 50 take place in?'},\n",
      " {'answers': [{'answer_start': 403, 'text': 'Santa Clara'},\n",
      "              {'answer_start': 403, 'text': 'Santa Clara'},\n",
      "              {'answer_start': 403, 'text': 'Santa Clara'}],\n",
      "  'id': '56beace93aeaaa14008c91e1',\n",
      "  'question': 'What city did Super Bowl 50 take place in?'},\n",
      " {'answers': [{'answer_start': 693, 'text': 'Super Bowl L'},\n",
      "              {'answer_start': 704, 'text': 'L'},\n",
      "              {'answer_start': 693, 'text': 'Super Bowl L'}],\n",
      "  'id': '56beace93aeaaa14008c91e2',\n",
      "  'question': 'If Roman numerals were used, what would Super Bowl 50 have been '\n",
      "              'called?'},\n",
      " {'answers': [{'answer_start': 116, 'text': '2015'},\n",
      "              {'answer_start': 112, 'text': 'the 2015 season'},\n",
      "              {'answer_start': 116, 'text': '2015'}],\n",
      "  'id': '56beace93aeaaa14008c91e3',\n",
      "  'question': 'Super Bowl 50 decided the NFL champion for what season?'},\n",
      " {'answers': [{'answer_start': 116, 'text': '2015'},\n",
      "              {'answer_start': 346, 'text': '2016'},\n",
      "              {'answer_start': 116, 'text': '2015'}],\n",
      "  'id': '56bf10f43aeaaa14008c94fd',\n",
      "  'question': 'What year did the Denver Broncos secure a Super Bowl title for '\n",
      "              'the third time?'},\n",
      " {'answers': [{'answer_start': 403, 'text': 'Santa Clara'},\n",
      "              {'answer_start': 403, 'text': 'Santa Clara'},\n",
      "              {'answer_start': 403, 'text': 'Santa Clara'}],\n",
      "  'id': '56bf10f43aeaaa14008c94fe',\n",
      "  'question': 'What city did Super Bowl 50 take place in?'},\n",
      " {'answers': [{'answer_start': 355, 'text': \"Levi's Stadium\"},\n",
      "              {'answer_start': 355, 'text': \"Levi's Stadium\"},\n",
      "              {'answer_start': 355, 'text': \"Levi's Stadium\"}],\n",
      "  'id': '56bf10f43aeaaa14008c94ff',\n",
      "  'question': 'What stadium did Super Bowl 50 take place in?'},\n",
      " {'answers': [{'answer_start': 267, 'text': '24–10'},\n",
      "              {'answer_start': 267, 'text': '24–10'},\n",
      "              {'answer_start': 267, 'text': '24–10'}],\n",
      "  'id': '56bf10f43aeaaa14008c9500',\n",
      "  'question': 'What was the final score of Super Bowl 50? '},\n",
      " {'answers': [{'answer_start': 334, 'text': 'February 7, 2016'},\n",
      "              {'answer_start': 334, 'text': 'February 7, 2016'},\n",
      "              {'answer_start': 334, 'text': 'February 7, 2016'}],\n",
      "  'id': '56bf10f43aeaaa14008c9501',\n",
      "  'question': 'What month, day and year did Super Bowl 50 take place? '},\n",
      " {'answers': [{'answer_start': 116, 'text': '2015'},\n",
      "              {'answer_start': 346, 'text': '2016'},\n",
      "              {'answer_start': 346, 'text': '2016'}],\n",
      "  'id': '56d20362e7d4791d009025e8',\n",
      "  'question': 'What year was Super Bowl 50?'},\n",
      " {'answers': [{'answer_start': 177, 'text': 'Denver Broncos'},\n",
      "              {'answer_start': 177, 'text': 'Denver Broncos'},\n",
      "              {'answer_start': 177, 'text': 'Denver Broncos'}],\n",
      "  'id': '56d20362e7d4791d009025e9',\n",
      "  'question': 'What team was the AFC champion?'},\n",
      " {'answers': [{'answer_start': 249, 'text': 'Carolina Panthers'},\n",
      "              {'answer_start': 249, 'text': 'Carolina Panthers'},\n",
      "              {'answer_start': 249, 'text': 'Carolina Panthers'}],\n",
      "  'id': '56d20362e7d4791d009025ea',\n",
      "  'question': 'What team was the NFC champion?'},\n",
      " {'answers': [{'answer_start': 177, 'text': 'Denver Broncos'},\n",
      "              {'answer_start': 177, 'text': 'Denver Broncos'},\n",
      "              {'answer_start': 177, 'text': 'Denver Broncos'}],\n",
      "  'id': '56d20362e7d4791d009025eb',\n",
      "  'question': 'Who won Super Bowl 50?'},\n",
      " {'answers': [{'answer_start': 116, 'text': '2015'},\n",
      "              {'answer_start': 112, 'text': 'the 2015 season'},\n",
      "              {'answer_start': 116, 'text': '2015'}],\n",
      "  'id': '56d600e31c85041400946eae',\n",
      "  'question': 'Super Bowl 50 determined the NFL champion for what season?'},\n",
      " {'answers': [{'answer_start': 177, 'text': 'Denver Broncos'},\n",
      "              {'answer_start': 177, 'text': 'Denver Broncos'},\n",
      "              {'answer_start': 177, 'text': 'Denver Broncos'}],\n",
      "  'id': '56d600e31c85041400946eb0',\n",
      "  'question': 'Which team won Super Bowl 50.'},\n",
      " {'answers': [{'answer_start': 403, 'text': 'Santa Clara, California.'},\n",
      "              {'answer_start': 355, 'text': \"Levi's Stadium\"},\n",
      "              {'answer_start': 355, 'text': \"Levi's Stadium\"}],\n",
      "  'id': '56d600e31c85041400946eb1',\n",
      "  'question': 'Where was Super Bowl 50 held?'},\n",
      " {'answers': [{'answer_start': 0, 'text': 'Super Bowl'},\n",
      "              {'answer_start': 0, 'text': 'Super Bowl'},\n",
      "              {'answer_start': 0, 'text': 'Super Bowl'}],\n",
      "  'id': '56d9895ddc89441400fdb50e',\n",
      "  'question': 'The name of the NFL championship game is?'},\n",
      " {'answers': [{'answer_start': 177, 'text': 'Denver Broncos'},\n",
      "              {'answer_start': 177, 'text': 'Denver Broncos'},\n",
      "              {'answer_start': 177, 'text': 'Denver Broncos'}],\n",
      "  'id': '56d9895ddc89441400fdb510',\n",
      "  'question': 'What 2015 NFL team one the AFC playoff?'}]\n"
     ]
    }
   ],
   "source": [
    "pprint(devdata.keys())\n",
    "pprint(len(devdata['data'])) # data is 48 datapieces\n",
    "pprint(len(devdata['data'][0]['paragraphs'])) # each datapiece has 54 paragraphs\n",
    "#each paragraph has 'context' which is a long string of words, basically the given passage\n",
    "#each paragraph \n",
    "pprint(devdata['data'][0]['paragraphs'][0]['context'])\n",
    "# pprint(devdata['data'][0]['paragraphs'][0]['qas'])\n",
    "# qas = devdata['data'][0]['paragraphs'][0]['qas'] \n",
    "# qas is a list of question-answers\n",
    "print()\n",
    "pprint(qas)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "ai",
   "language": "python",
   "name": "ai"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
